package com.apes.fn.server.reworkAppraisal.repository;


import com.alibaba.fastjson.JSONObject;
import com.apes.framework.query.ApesDao;
import org.springframework.stereotype.Component;

/**
 * @Classname ReworkAppraisalToSql
 * @Description f返修鉴定单相关 手写sql查询,更新
 * @Date 2020/1/6 15:52
 * @Created by Administrator
 */
@Component
public class ReworkAppraisalToSql extends ApesDao {
    /***
     * 更新服务方案质保标记
     */
    public int updateServicePlanItem(JSONObject param) {
        String sSQL ="update ser_service_plan_item a " +
                "   set a.warranty_status ='B'  where a.product_id =:product " +
                " and a.service_plan_id =:servicePlan and a.service_state ='yes' " +
                " and a.dispatch_state not in ('termination') and a.sale_qty >0 ";
        return update(sSQL, param);
    }

    /***
     * 更新返修鉴定单明细红包金额以及质保状态
     */
    public int updateReworkAppraisalItem(JSONObject param) {
        String sSQL ="update crm_rework_appraisal_item a " +
                "   set a.red_packet =:redPacket, a.warranty_status = :warrantyStatus " +
                " where a.product_id =:product and a.rework_appraisal_id =:reworkAppraisal and a.id =:id ";
        return update(sSQL, param);
    }
}
